package com.BraveY.Demo02;

import java.util.Scanner;

public class Demo03 {
    public static void main(String[] args) {
/*        录入三个整数
          对三个整数排序并输出*/
        Scanner s = new Scanner(System.in);
        int[] arr = new int[3];
        for (int i = 0; i < 3; i++) {
            System.out.println("请输入第" + (i + 1) + "个参数：");
            int score = s.nextInt();
            arr[i] = score;
        }
        int max = getMax(arr);
        System.out.println("该数组最大的数是："+ max);

    }

    public static int getMax(int[] arr) {
        if (arr.length == 0) return -1;
        int max = arr[0];
        for (int i = 0; i < arr.length; i++) {
            if (max < arr[i]) {
                max = arr[i];
            }
        }
        return max;
    }
}
